package com.example.starttrekking;

import java.util.List;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.facebook.Request;
import com.facebook.Response;
import com.facebook.Session;
import com.facebook.model.GraphUser;

public class ListaDeTrekkersFragment extends Fragment {
	@Override
	public View onCreateView(LayoutInflater inflater,
			ViewGroup container, Bundle savedInstanceState) {
		//Inflate the layout for this fragment
		Session session = Session.getActiveSession();
		if (session != null)
		{
			Request request = Request.newMyFriendsRequest(session, new Request.GraphUserListCallback() {
				@Override
				public void onCompleted(List<GraphUser> users, Response response) {
					// If the response is successful
					for (GraphUser user : users) {
						System.out.println(user.getFirstName() + " " + user.getLastName());
					}

				}
			});
			
			Bundle bundle = request.getParameters();
			bundle.putString("fields", "id,first_name,last_name,birthday,location");
			request.executeAsync();
		}
		

		// here add fields explicitly
		
		return inflater.inflate(
				R.layout.lista_de_trekkers, container, false);
	}

}
